//
//  String+Num.swift
//  NyamanDana
//
//  Created by 李永彬 on 2025/11/1.
//

import Foundation

extension String {
    func maskMiddleCharacters() -> String {
        guard self.count >= 6 else { return self }
        
        var characters = Array(self)
        
        // 使用更函数式的方式
        let startIndex = 2
        let endIndex = min(6, characters.count)
        
        for i in startIndex..<endIndex {
            characters[i] = "*"
        }
        
        return String(characters)
    }
}
